/*
 * @Descripttion: 
 * @Version: 
 * @Author: 王传宝
 * @Date: 2023-02-27 20:23:11
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2023-02-28 14:59:49
 */
import { createSlice } from "@reduxjs/toolkit";

const searchSlice = createSlice({
    name: "search",
    initialState: {
        histories: [],
        keyword:'',
        searchInfo:''
    },
    reducers: {
        changeHistory: (state:any, action) => {
            state.histories.push(action.payload)
        },
        clearHistory: (state: any) => {
            state.histories = []
        },
        changeKeyword:(state: any,action) => {
            state.keyword = action.payload
        },
        changeSearchInfo:(state:any, action) => {
            state.searchInfo = action.payload
        },
    }
})

export const { changeHistory, clearHistory ,changeKeyword,changeSearchInfo} = searchSlice.actions

export default searchSlice.reducer